import { Cache } from "../../../cache/Cache";
type int = number;
//class HonorShopBuyLimitInfo
    
    export  class HonorShopBuyLimitInfo
    {
        constructor()
        {
            
            this._itemBuyLimitDict = new Map<any, any> /* flash.utils.Dictionary */();
            return;
        }

        public get buyNumDict(): Map<any, any> /* flash.utils.Dictionary */
        {
            return this._buyNumDict;
        }

        public set buyNumDict(arg1: Map<any, any> /* flash.utils.Dictionary */)
        {
            this._buyNumDict = arg1;
            return;
        }

        public updateBuyLimit(arg1: int, arg2: int): void
        {
            this._itemBuyLimitDict[arg1] = arg2;
            return;
        }

        public getConstName(arg1: int): string
        {
            return "InterHonourItemLimit" + arg1;
        }

        public getAmountLabel(arg1: int): string
        {
            if (this.isInLimit(arg1)) 
            {
                return this.getAreadyBuyNum(arg1) + "/" + this._itemBuyLimitDict[arg1];
            }
            return "";
        }

        public isFullBuy(arg1: int): Boolean
        {
            if (this._itemBuyLimitDict && this.getAreadyBuyNum(arg1) == this._itemBuyLimitDict[arg1]) 
            {
                return true;
            }
            return false;
        }

        public getAreadyBuyNum(arg1: int): int
        {
            if (this._buyNumDict && this._buyNumDict[arg1]) 
            {
                return this._buyNumDict[arg1];
            }
            return 0;
        }

        public isInLimit(arg1: int): Boolean
        {
            var loc1=null;
            var loc2=0;
            var loc3=this._itemBuyLimitDict;
            for (loc1 in loc3) 
            {
                if (loc1.indexOf(arg1.toString()) == -1) 
                {
                    continue;
                }
                return true;
            }
            return false;
        }

        public getLeftNum(arg1: int, arg2: int): int
        {
            var loc1=0;
            var loc2=Math.floor(Cache.instance.role.money.interHonour / arg2);
            var loc3=-1;
            if (this._itemBuyLimitDict && this.isInLimit(arg1)) 
            {
                loc1 = this._itemBuyLimitDict[arg1] - this.getAreadyBuyNum(arg1);
                loc3 = Math.min(loc2, loc1);
            }
            return loc3;
        }

        /* internal */ /* var */_itemBuyLimitDict: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_buyNumDict: Map<any, any> /* flash.utils.Dictionary */;
    }
